package com.miao.mygps;

import android.app.Activity;
import android.location.Location;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;

import com.miao.mygps.MyLocation.LocationResult;

public class MyGPS extends Activity {

	MyLocation myLocation = new MyLocation();
	public LocationResult locationResult = new LocationResult() {

		@Override
		public void gotLocation(Location location) {
			Log.e("--", location.getLatitude() + "," + location.getLongitude());
		}
	};

	private void locationClick() {
		myLocation.getLocation(this, locationResult);
	}

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see android.app.Activity#onKeyDown(int, android.view.KeyEvent)
	 */
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		locationClick();
		return super.onKeyDown(keyCode, event);
	}
}